home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "TimeFrame"
- ClientHeight = 2955
- ClientLeft = 1200
- ClientTop = 1545
- ClientWidth = 2265
- Height = 3360
- Icon = TIMEFRAM.FRX:0000
- Left = 1140
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 2955
- ScaleWidth = 2265
- Top = 1200
- Width = 2385
- Begin CommandButton btnEnd
- Caption = "End"
- Height = 375
- Left = 1320
- TabIndex = 6
- Top = 2160
- Width = 855
- End
- Begin Timer Timer1
- Interval = 1000
- Left = 960
- Top = 2160
- End
- Begin CommandButton btnOk
- Caption = "Ok"
- Height = 375
- Left = 120
- TabIndex = 1
- Top = 2160
- Width = 855
- End
- Begin Frame Frame1
- Caption = "Clock Position"
- Height = 975
- Left = 120
- TabIndex = 7
- Top = 960
- Width = 2055
- Begin OptionButton rbtnRight
- Caption = "on the Right"
- Height = 255
- Left = 120
- TabIndex = 9
- Top = 600
- Width = 1815
- End
- Begin OptionButton rbtnLeft
- Caption = "on the Left"
- Height = 255
- Left = 120
- TabIndex = 8
- Top = 360
- Value = -1 'True
- Width = 1815
- End
- End
- Begin HScrollBar scrInterval
- Height = 255
- Left = 120
- Max = 10
- Min = 1
- TabIndex = 2
- Top = 600
- Value = 1
- Width = 2055
- End
- Begin Label Label3
- Alignment = 2 'Center
- Caption = "by J. Br
- uchi"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Left = 120
- TabIndex = 5
- Top = 2640
- Width = 2055
- End
- Begin Label Label2
- Caption = "sec"
- Height = 255
- Left = 1800
- TabIndex = 4
- Top = 240
- Width = 375
- End
- Begin Label lblInterval
- BorderStyle = 1 'Fixed Single
- Height = 255
- Left = 1200
- TabIndex = 3
- Top = 240
- Width = 375
- End
- Begin Label Label1
- Caption = "Interval"
- Height = 255
- Left = 120
- TabIndex = 0
- Top = 240
- Width = 855
- End
- ' TIMEFRAME by J. Braeuchi
- ' Display current time in caption of active Window
- Const init_timer% = 5 ' Initial Interval (sec)
- Dim parentwin As Integer ' Handle of Parent
- Dim holdwin As Integer ' Handle of Old
- Dim capold As String ' Caption of Old
- Sub btnEnd_Click ()
- ' End Program
- Unload Form1
- End Sub
- Sub btnOk_Click ()
- ' Minimize Program
- Form1.WindowState = 1
- End Sub
- Sub Form_Load ()
- parentwin = GetActiveWindow()
- holdwin = 0
- capold = ""
- scrInterval.Value = init_timer%
- lblInterval.caption = Str$(init_timer%)
- Timer1.interval = 1000 * init_timer% ' Milliseconds
- End Sub
- Sub Form_Resize ()
- ' Switch to parent if minimized
- If Form1.WindowState = 1 Then
- dummy% = SetActiveWindow(parentwin)
- End If
- End Sub
- Sub Form_Unload (Cancel As Integer)
- ' Disable Timer
- Timer1.interval = 0
- If holdwin <> 0 Then
- Call SetWindowText(holdwin, capold) ' Restore Caption
- End If
- End Sub
- Sub scrInterval_Change ()
- ' Interval Scrollbar Change
- lblInterval.caption = Str$(scrInterval.Value)
- Timer1.interval = scrInterval.Value * 1000
- End Sub
- Sub Timer1_Timer ()
- ' Add Current Time to Caption of Active Window
- Dim hawin As Integer
- Dim caption As String
- Dim caplen As Integer
- ' Handle of Active Window , exit if own handle
- hawin = GetActiveWindow()
- If hawin = Form1.hWnd Then
- Exit Sub
- End If
- ' Update Time if still same Window active
- ' Choose wether Clock is displayed left or right of caption
- If hawin = holdwin Then
- If rbtnLeft.Value = True Then
- caption = "<" + Time$ + "> " + capold
- Else
- caption = capold + " <" + Time$ + ">"
- End If
-
- Call SetWindowText(holdwin, caption)
- Exit Sub
- Else
- If holdwin <> 0 Then
- Call SetWindowText(holdwin, capold) ' Restore Caption
- End If
- ' Get Caption of active Window
- caplen = GetWindowTextLength(hawin)
- capold = Space$(caplen + 1) ' +1 for terminating 0
- dummy% = GetWindowText(hawin, capold, caplen + 1)
- capold = Left$(capold, caplen) ' cut terminating 0
- holdwin = hawin
- Timer1_Timer ' immediate display
- End If
- End Sub
-